package com.kaigejava.factorypattern.simplefactorypattern;

import com.kaigejava.factorypattern.simplefactorypattern.impl.*;

/**
 * Created by kaigejava on 2019/8/23.
 * 制作面条的面馆-简单工厂模式
 */
public class NoodlesSimpleFactory {
    /** 菜单 ***/
    public static final int NOODLES_TYPE_1=1 ;//西红柿鸡蛋面
    public static final int NOODLES_TYPE_2 = 2;//牛肉拉面
    public static final int NOODLES_TYPE_3 = 3;//刀削面
    public static final int NOODLES_TYPE_4 = 4;//哨子面
    public static final int NOODLES_TYPE_5 = 5;//biangbiang面
    public static final int NOODLES_TYPE_6 = 6;//热干面

    /**
     * 根据菜单上的序号，制作不同的面条
     * @param noodletType
     * @return
     */
    public  static INoodlesInterface makeNoodlesByMenuType(int noodletType){
        switch (noodletType){
            case NOODLES_TYPE_1:
                return new TomatoAndEggNoodles("西红柿鸡蛋面");
            case NOODLES_TYPE_2:
                return new HandPulledNoodleSoupWithBeef("牛肉拉面");
            case NOODLES_TYPE_3:
                return new HandPulledNoodleSoupWithBeef("刀削面");
            case NOODLES_TYPE_4:
                return new NoodleWithPork("哨子面");
            case NOODLES_TYPE_5:
                return  new BiangBiangNoodles("biangbiang面");
            case NOODLES_TYPE_6:
                return new HotAndDryNoodles("热干面");
            default:
                return  new HotAndDryNoodles("热干面");
        }
    }

    /**
     * 根据面名称，制作不同的面条
     * @param noodelsName
     * @return
     */
    public  static INoodlesInterface makeNoodlesByNoodlesName(String noodelsName){
        switch (noodelsName){
            case "西红柿鸡蛋面":
                return new TomatoAndEggNoodles(noodelsName);
            case "牛肉拉面":
                return new HandPulledNoodleSoupWithBeef(noodelsName);
            case "刀削面":
                return new HandPulledNoodleSoupWithBeef(noodelsName);
            case "哨子面":
                return new NoodleWithPork(noodelsName);
            case "biangbiang面":
                return  new BiangBiangNoodles(noodelsName);
            case "热干面":
                return new HotAndDryNoodles(noodelsName);
            default:
                return  new HotAndDryNoodles("热干面");
        }
    }




}
